package com.usian.admin.controller;

import com.usian.admin.service.AdUserService;
import com.usian.apis.admin.AdUserControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.admin.pojos.AdUser;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/user")
@Api(value = "用户管理",tags = "user",description="用户管理api")
public class AdUserController implements AdUserControllerApi {
    @Autowired
    AdUserService adUserService;
    @Override
    @RequestMapping("in")
    @ApiParam(name = "dto",type = "AdUserDto",value = "登录",required = true)
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return adUserService.login(dto);
    }

    @Override
    @RequestMapping("register")
    @ApiParam(name = "adUser",type = "AdUser",value = "注册",required = true)
    public ResponseResult register(@RequestBody AdUser adUser) {
        return adUserService.register(adUser);
    }
}
